#ifndef CODE_GENERATOR_H
#define CODE_GENERATOR_H

#include "../../PascalInterface/ICodeGenerator.h"

namespace SimplePascal
{
	class CodeGenerator : public ICodeGenerator, private SyntaxTreeVisitor
	{
	private:
		virtual void Visit(PrimitiveType* type);
		virtual void Visit(PointerType* type);
		virtual void Visit(Parameter* parameter);
		virtual void Visit(FunctionType* type);
		virtual void Visit(PrimitiveExpression* expression);
		virtual void Visit(LiteralExpression* expression);
		virtual void Visit(VariableExpression* expression);
		virtual void Visit(Argument* argument);
		virtual void Visit(InvokeExpression* expression);
		virtual void Visit(CastExpression* expression);
		virtual void Visit(SizeOfExpression* expression);
		virtual void Visit(NotExpression* expression);
		virtual void Visit(AddressExpressoin* expression);
		virtual void Visit(PointerValueExpression* expression);
		virtual void Visit(RelationExpression* expression);
		virtual void Visit(AndExpression* expression);
		virtual void Visit(OrExpression* expression);
		virtual void Visit(AddExpression* expression);
		virtual void Visit(SubExpression* expression);
		virtual void Visit(MulExpression* expression);
		virtual void Visit(DivExpression* expression);
		virtual void Visit(ExpressionStatement* statement);
		virtual void Visit(AssignStatement* statement);
		virtual void Visit(IfStatement* statement);
		virtual void Visit(WhileStatement* statement);
		virtual void Visit(RepeatStatement* statement);
		virtual void Visit(ControlStatement* statement);
		virtual void Visit(ResultStatement* statement);
		virtual void Visit(BlockStatement* statement);
		virtual void Visit(Variable* variable);
		virtual void Visit(Var* var);
		virtual void Visit(Function* function);
		virtual void Visit(Program* program);

	public:
		virtual IAssembly* Generate(Program* program);
	};
}

#endif